Update comments around spin_trylock() usage for sysctl and xenpf locks.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 15 Apr 2010 10:33:39 +0000 (11:33 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 15 Apr 2010 10:33:39 +0000 (11:33 +0100)
Since the execution of stop_machine_run() via cpu_down() is now always
deferred to a hypercall continuation context, the above locks are not
held at that time. Hence the trylock is not specifically to avoid
deadlock with stop_machine_run(), but rather a more general paranoia
about deadlocks in general.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/platform_hypercall.c
xen/common/sysctl.c

index dc2214930a3b4292ed88a7340ab98d248f2f8d20..26883b4d1c09766811261739ed80537e9219b863 100644 (file)
@@ -73,7 +73,11 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
     if ( op->interface_version != XENPF_INTERFACE_VERSION )
         return -EACCES;
 
-    /* spin_trylock() avoids deadlock with stop_machine_run(). */
+    /*
+     * Trylock here avoids deadlock with an existing platform critical section
+     * which might (for some current or future reason) want to synchronise
+     * with this vcpu.
+     */
     while ( !spin_trylock(&xenpf_lock) )
         if ( hypercall_preempt_check() )
             return hypercall_create_continuation(
index ba163532661a57a379b485d216d226e71b13e740..db27fc233c88aca3585d9d9a8323d35ee3835d83 100644 (file)
@@ -48,7 +48,11 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
     if ( op->interface_version != XEN_SYSCTL_INTERFACE_VERSION )
         return -EACCES;
 
-    /* spin_trylock() avoids deadlock with stop_machine_run(). */
+    /*
+     * Trylock here avoids deadlock with an existing sysctl critical section
+     * which might (for some current or future reason) want to synchronise
+     * with this vcpu.
+     */
     while ( !spin_trylock(&sysctl_lock) )
         if ( hypercall_preempt_check() )
             return hypercall_create_continuation(